<?php

namespace Worker\Controller;

use Common\Controller\BaseController;

class LoginController extends BaseController
{
    private $userLogic;


    public function _initialize()
    {
        parent::_initialize();
        $this->userLogic = A('Worker/User', 'Logic');
    }

    public function index()
    {
        $this->display();
    }

    /**
     * 登陆账号
     */
    public function doLogin()
    {
        $phone = I('post.phone');
        $password = I('post.password');
        $res = $this->userLogic->login($phone, $password);
        $this->ajaxReturn($res);
    }

    /**
     * 退出登录
     */
    public function doLogout()
    {
        $res = $this->userLogic->logout();
        $this->ajaxReturn($res);
    }
}
